package com.ruoyi.flowable.mapper;

import com.ruoyi.flowable.domain.WorkOrderAssetRel;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface WorkOrderAssetRelMapper {

    /**
     * 根据ID查询
     */
    WorkOrderAssetRel selectWorkOrderAssetRelById(Long id);

    /**
     * 查询列表
     */
    List<WorkOrderAssetRel> selectWorkOrderAssetRelList(WorkOrderAssetRel workOrderAssetRel);

    /**
     * 新增
     */
    int insertWorkOrderAssetRel(WorkOrderAssetRel workOrderAssetRel);

    /**
     * 修改
     */
    int updateWorkOrderAssetRel(WorkOrderAssetRel workOrderAssetRel);

    /**
     * 删除
     */
    int deleteWorkOrderAssetRelById(Long id);

    /**
     * 根据流程实例ID查询（主要查询方法）
     */
    WorkOrderAssetRel selectByProcInsId(String procInsId);

    /**
     * 根据资产ID查询工单记录
     */
    List<WorkOrderAssetRel> selectByAssetId(Long assetId);

    /**
     * 根据流程实例ID列表批量查询
     */
    List<WorkOrderAssetRel> selectByProcInsIds(List<String> procInsIds);

    /**
     * 根据流程实例ID删除记录
     */
    int deleteByProcInsId(String procInsId);

    /**
     * 根据流程实例ID批量删除记录
     * @param procInsIds
     * @return
     */
    public int deleteByProcInsIds(String[] procInsIds);

    /**
     * 根据资产ID删除记录
     */
    int deleteByAssetId(Long assetId);

    /**
     * 更新工单状态
     */
    int updateWorkOrderStatus(@Param("procInsId") String procInsId,
                              @Param("workOrderStatus") String workOrderStatus,
                              @Param("finishTime") java.util.Date finishTime);

    /**
     * 更新预计完成时间
     */
    int updatePlanFinishTime(@Param("procInsId") String procInsId,
                             @Param("planFinishTime") java.util.Date planFinishTime);

    /**
     * 更新资产信息
     */
    int updateAssetInfo(@Param("procInsId") String procInsId,
                        @Param("assetId") Long assetId,
                        @Param("assetName") String assetName,
                        @Param("assetNumber") String assetNumber);

    /**
     * 查询我的工单列表
     */
    List<WorkOrderAssetRel> selectMyWorkOrders(@Param("userId") Long userId,
                                               @Param("status") String status,
                                               @Param("procDefName") String procDefName,
                                               @Param("assetName") String assetName);
}
